package tr.com.netgis;

import java.util.List;

import android.graphics.drawable.Drawable;
import android.os.Bundle;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

/**
 * 
 * Map view
 * @author NetGis
 *
 */
public class MapViewActivity extends MapActivity  {
	
	MapView mapView;
	List<Overlay> mapOverlays;
	Drawable drawable;
	NGItemizedOverlay itemizedOverlay;
	static GeoPoint POINT;

	public static void setGeoPoint (GeoPoint point) {
		POINT = point;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.map);
		mapView = (MapView)findViewById(R.id.mapview);
		mapView.setBuiltInZoomControls(true);
		
		mapOverlays = mapView.getOverlays();
		drawable = this.getResources().getDrawable(R.drawable.pin);
		itemizedOverlay = new NGItemizedOverlay(drawable);	

	}
	
    @Override
	protected void onResume() {
		super.onResume();
		OverlayItem _overItem = new OverlayItem(POINT, "", "");
		itemizedOverlay.addOverlay(_overItem);
		mapOverlays.add(itemizedOverlay);
		mapView.getController().setCenter(_overItem.getPoint());
		mapView.getController().setZoom(15);
	}

	@Override
	protected boolean isRouteDisplayed()
	{
	    return false;
	}

}
